/**
 * 
 */
package pt.inescid.components.console.commands;

import pt.inescid.components.console.Console;

/**
 * @author Sergio Esteves (sesteves at gsd.inesc-id.pt)
 *
 */
public class SetMaxStorageCommand extends Command {

	public static final String CMD_NAME = "set_max_storage";
	
	public SetMaxStorageCommand(Console console) {
		super(console);
	}

	@Override
	public void execute(String[] args) throws CommandException {
		this.validateArgs(args, 2, 2);
		long size = Long.parseLong(args[1]) * 1048576;
		gridP2P.setMaxStorage(size);
	}

	@Override
	public String getCmdName() {
		return CMD_NAME;
	}

	@Override
	public String synopsis() {
		return CMD_NAME + " size" + SYNTAX_SEPARATOR +
			"sets the maximum disk space (MB) that can be used.";
	}
}
